#include <stdio.h>
#define MYTYPE(X) _Generic((X), int: "int", float: "float", double: "double", default: "other")
#define MYFUNC(X, Y) _Generic((X), int: func_int, double: func_double, float: func_float)(X, Y)

int func_int(int x, int y)
{
    printf("call func_int.\n");
    return x + y;
}

double func_double(double x, double y)
{
    printf("call func_double.\n");
    return x + y;
}

float func_float(float x, float y)
{
    printf("call func_float.\n");
    return x + y;
}

int main()
{
    int x1 = 2, y1 = 3;
    printf("%s\n", MYTYPE(3));      // int
    printf("%d\n", MYFUNC(x1, y1)); // 调用func_int(x1, y1);
    return 0;
}
